package iteratorPattern.demo;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author： pang-yun
 * @date： 2021-12-10 09:52
 * 功能目的 ：用于
 */

public class InfoCollege implements College {
    List<Department> departments;

    public InfoCollege() {
        this.departments=new ArrayList<>();
        addDepartment("a","a");
        addDepartment("b","b");
        addDepartment("c","c");
        addDepartment("d","d");
        addDepartment("e","e");
    }

    @Override
    public String getName() {
        return "信息工程学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department= new Department(name, desc);
        departments.add(department);
    }

    @Override
    public Iterator createIterator() {
        return new InfoCollegeIterator(departments);
    }
}
